package com.ruoyi.common.core.domain.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseJpa;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import javax.persistence.Column;
import javax.persistence.Id;
import java.sql.Timestamp;
import java.util.Collection;

/**
 * @author Dale Mao    ---多多 Email:453918229@qq.com
 * @description CdUser
 * @date 2021-01-27 10:19
 */
public class CdUser extends BaseJpa implements Authentication, UserDetails {



    private Long id;


    private String nickname;



    private String imgUrl;


    private String password;


    private String phone;


    private String wxopenId;




    private String wxMiniOpenId;


    private String unionId;


    private String aliopenId;


    private String province;


    private String city;



    private String address;

    private String smsCode;


    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Timestamp createTime;


    private Integer status;

    /** 更新时间 */

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Timestamp updateTime;



    private String  token;

    @Override
    public Timestamp getCreateTime() {
        return createTime;
    }

    @Override
    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Override
    public Integer getStatus() {
        return status;
    }

    @Override
    public void setStatus(Integer status) {
        this.status = status;
    }

    @Override
    public Timestamp getUpdateTime() {
        return updateTime;
    }

    @Override
    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public CdUser(String wxopenId) {
        this.wxopenId = wxopenId;
    }

    public CdUser( String phone,String password, String smsCode) {

        this.password = password;
        this.phone = phone;
        this.smsCode = smsCode;
    }

    public CdUser() {
    }

    @Override
    public String toString() {
        return "CdUser{" +
                "id=" + id +
                ", nickname='" + nickname + '\'' +
                ", imgUrl='" + imgUrl + '\'' +
                ", password='" + password + '\'' +
                ", phone='" + phone + '\'' +
                ", wxopenId='" + wxopenId + '\'' +
                ", wxMiniOpenId='" + wxMiniOpenId + '\'' +
                ", unionId='" + unionId + '\'' +
                ", aliopenId='" + aliopenId + '\'' +
                ", province='" + province + '\'' +
                ", city='" + city + '\'' +
                ", address='" + address + '\'' +
                ", smsCode='" + smsCode + '\'' +
                '}';
    }

    @Override
    public String getName() {
        return null;
    }

    public String getSmsCode() {
        return smsCode;
    }

    public void setSmsCode(String smsCode) {
        this.smsCode = smsCode;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getImgUrl() {
        return imgUrl;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    public String getPassword() {
        return password;
    }

    @Override
    public String getUsername() {
        return null;
    }

    @Override
    public boolean isAccountNonExpired() {
        return false;
    }

    @Override
    public boolean isAccountNonLocked() {
        return false;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return false;
    }

    @Override
    public boolean isEnabled() {
        return false;
    }


    public void setPassword(String password) {
        this.password = password;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getWxopenId() {
        return wxopenId;
    }

    public void setWxopenId(String wxopenId) {
        this.wxopenId = wxopenId;
    }

    public String getWxMiniOpenId() {
        return wxMiniOpenId;
    }

    public void setWxMiniOpenId(String wxMiniOpenId) {
        this.wxMiniOpenId = wxMiniOpenId;
    }

    public String getUnionId() {
        return unionId;
    }

    public void setUnionId(String unionId) {
        this.unionId = unionId;
    }

    public String getAliopenId() {
        return aliopenId;
    }

    public void setAliopenId(String aliopenId) {
        this.aliopenId = aliopenId;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public Object getCredentials() {
        return null;
    }

    @Override
    public Object getDetails() {
        return null;
    }

    @Override
    public Object getPrincipal() {
        return null;
    }

    @Override
    public boolean isAuthenticated() {
        return false;
    }

    @Override
    public void setAuthenticated(boolean b) throws IllegalArgumentException {

    }
}
